package com.StartGame;

import android.app.*;
import android.content.*;
import android.os.*;
import android.util.*;
import android.view.*;

public class MainActivity extends Activity {

	// MyGameView�� ������ �����
	MyGameView mGameView;
	boolean isPause = false;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		mGameView = (MyGameView) findViewById(R.id.mGameView);
	}

	// -------------------------------------
	// Option Menu
	// -------------------------------------
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		menu.add(0, 1, 0, "Quit Game");
		menu.add(0, 2, 0, "Pause Game");
		return true;
	}

	// -------------------------------------
	// onOptions ItemSelected
	// -------------------------------------
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case 1: // Quit Game
			mGameView.StopGame();
			finish();
			break;
		case 2: // Pause/Resume
			isPause = !isPause;
			if (isPause) {
				mGameView.PauseGame();
				item.setTitle("Resume Game");
			} else {
				mGameView.ResumeGame();
				item.setTitle("Pause Game");
			}
			break;
		}
		return true;
	}
}